package com.lineage.server.model;

import com.add.AutoAttackUpdate;
import com.add.AutoAttackUpdateNew;
import com.add.TFUpdate;
import com.add.system.CardBookCmd;
import com.lineage.DatabaseFactory;
import com.lineage.FollowAutoAttackUpdate;
import com.lineage.config.ConfigAlt;
import com.lineage.config.ConfigClan;
import com.lineage.config.ConfigOther;
import com.lineage.data.QuestClass;
import com.lineage.server.beans.clan.ClanLevelUpCondition;
import com.lineage.server.clientpackets.C_CreateChar;
import com.lineage.server.command.executor.L1ToPC2;
import com.lineage.server.datatables.ExpTable;
import com.lineage.server.datatables.ItemTable;
import com.lineage.server.datatables.PolyTable;
import com.lineage.server.datatables.QuestTable;
import com.lineage.server.datatables.RecordTable;
import com.lineage.server.datatables.SkillsTable;
import com.lineage.server.datatables.lock.CharacterQuestReading;
import com.lineage.server.datatables.sql.CharacterTable;
import com.lineage.server.datatables.sql.ClanTable;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.skill.L1SkillUse;
import com.lineage.server.model.wenyang.L1Gelanken;
import com.lineage.server.model.wenyang.L1Mapule;
import com.lineage.server.model.wenyang.L1Pageliao;
import com.lineage.server.model.wenyang.L1Shaha;
import com.lineage.server.model.wenyang.L1Yinhaisa;
import com.lineage.server.model.wenyang.L1Yiwa;
import com.lineage.server.serverpackets.S_Bonusstats;
import com.lineage.server.serverpackets.S_CloseList;
import com.lineage.server.serverpackets.S_Message_YN;
import com.lineage.server.serverpackets.S_NPCTalkReturn;
import com.lineage.server.serverpackets.S_OwnCharStatus;
import com.lineage.server.serverpackets.S_OwnCharStatus2;
import com.lineage.server.serverpackets.S_PacketBox;
import com.lineage.server.serverpackets.S_Paralysis;
import com.lineage.server.serverpackets.S_SPMR;
import com.lineage.server.serverpackets.S_ServerMessage;
import com.lineage.server.serverpackets.S_SystemMessage;
import com.lineage.server.serverpackets.S_War;
import com.lineage.server.serverpackets.ServerBasePacket;
import com.lineage.server.templates.L1Item;
import com.lineage.server.templates.L1Quest;
import com.lineage.server.templates.L1Skills;
import com.lineage.server.thread.GeneralThreadPool;
import com.lineage.server.utils.CalcStat;
import com.lineage.server.utils.SQLUtil;
import com.lineage.server.world.World;
import com.lineage.server.world.WorldClan;
import com.lineage.william.ItemAction;
import com.lineage.william.ItemActionPoly;
import com.lineage.william.ItemShop;
import com.lineage.william.PayBonus;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class L1ActionPc {
  public static final Random _random;
  
  private static final Log _log = LogFactory.getLog(L1ActionPc.class);
  
  private static BufferedWriter out;
  
  private final L1PcInstance _pc;
  
  static {
    _random = new Random();
  }
  
  public L1ActionPc(L1PcInstance pc) {
    this._pc = pc;
  }
  
  public static void showStartQuest(L1PcInstance pc, int objid) {
    try {
      (pc.get_otherList()).QUESTMAP.clear();
      int key = 0;
      int i = QuestTable.MINQID;
      while (i <= QuestTable.MAXQID) {
        L1Quest value = QuestTable.get().getTemplate(i);
        if (value != null && 
          !pc.getQuest().isEnd(value.get_id()) && 
          pc.getQuest().isStart(value.get_id()))
          (pc.get_otherList()).QUESTMAP.put(Integer.valueOf(key++), value); 
        i++;
      } 
      if ((pc.get_otherList()).QUESTMAP.size() <= 0) {
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(objid, "y_q_not7"));
      } else {
        L1ActionShowHtml show = new L1ActionShowHtml(pc);
        show.showQuestMap(0);
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  public static void showQuest(L1PcInstance pc, int objid) {
    try {
      (pc.get_otherList()).QUESTMAP.clear();
      int key = 0;
      int i = QuestTable.MINQID;
      while (i <= QuestTable.MAXQID) {
        L1Quest value = QuestTable.get().getTemplate(i);
        if (value != null && pc.getLevel() >= value.get_questlevel() && 
          !pc.getQuest().isEnd(value.get_id()) && 
          !pc.getQuest().isStart(value.get_id()) && 
          value.check(pc))
          (pc.get_otherList()).QUESTMAP.put(Integer.valueOf(key++), value); 
        i++;
      } 
      if ((pc.get_otherList()).QUESTMAP.size() <= 0) {
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(objid, "y_q_not4"));
      } else {
        L1ActionShowHtml show = new L1ActionShowHtml(pc);
        show.showQuestMap(0);
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  public static void showQuestAll(L1PcInstance pc, int objid) {
    try {
      (pc.get_otherList()).QUESTMAP.clear();
      int key = 0;
      int i = QuestTable.MINQID;
      while (i <= QuestTable.MAXQID) {
        L1Quest value = QuestTable.get().getTemplate(i);
        if (value != null && value.check(pc))
          (pc.get_otherList()).QUESTMAP.put(Integer.valueOf(key++), value); 
        i++;
      } 
      L1ActionShowHtml show = new L1ActionShowHtml(pc);
      show.showQuestMap(0);
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  private static synchronized void checkSponsor(L1PcInstance pc) {
    Connection con = null;
    PreparedStatement pstm = null;
    ResultSet rs = null;
    PreparedStatement pstm2 = null;
    try {
      String AccountName = pc.getAccountName();
      con = DatabaseFactory.get().getConnection();
      pstm = con.prepareStatement(
          "select ordernumber,amount,payname,state from ezpay where state = 1 and payname ='" + AccountName + 
          "'");
      rs = pstm.executeQuery();
      boolean isfind = false;
      while (rs.next() && rs != null) {
        int serial = rs.getInt("ordernumber");
        if (pc.getAccountName().equalsIgnoreCase(rs.getString("payname"))) {
          isfind = true;
          pstm2 = con.prepareStatement("update ezpay set state = 2 where ordernumber = ?");
          pstm2.setInt(1, serial);
          pstm2.execute();
          int count = rs.getInt("amount");
          GiveItem(pc, 44070, count);
          PayBonus.getItem(pc, count);
          pc.setpaycount(pc.getpaycount() + count);
          writeSponsorlog(pc, count);
        } 
      } 
      if (!isfind)
        pc.sendPackets((ServerBasePacket)new S_ServerMessage("尚未侦测到关于您的赞助。")); 
    } catch (SQLException e) {
      _log.error(e.getLocalizedMessage());
    } finally {
      SQLUtil.close(rs);
      SQLUtil.close(pstm);
      SQLUtil.close(pstm2);
      SQLUtil.close(con);
    } 
  }
  
  public static void GiveItem(L1PcInstance pc, int itemId, int count) {
    L1ItemInstance item = ItemTable.get().createItem(itemId);
    item.setCount(count);
    if (pc.getInventory().checkAddItem(item, count) == 0) {
      pc.getInventory().storeItem(item);
      pc.sendPackets((ServerBasePacket)new S_ServerMessage("本次赞助共获得： " + item.getLogName() + "。"));
    } 
  }
  
  public static void writeSponsorlog(L1PcInstance player, int count) {
    try {
      File DeleteLog = new File("自动赞助\\赞助领取资料.log");
      if (DeleteLog.createNewFile()) {
        (out = new BufferedWriter(new FileWriter("自动赞助\\赞助领取资料.log", false)))
          .write("※以下是玩家[领取赞助]的所有纪录※\r\n");
        out.close();
      } 
      (out = new BufferedWriter(new FileWriter("自动赞助\\赞助领取资料.log", true))).write("\r\n");
      out.write("来自帐号: " + player.getAccountName() + "来自ip: " + player.getNetConnection().getIp() + 
          ",来自玩家: " + player.getName() + ",领取了: " + count + " 个 " + ",<领取时间:" + 
          new Timestamp(System.currentTimeMillis()) + ">" + "\r\n");
      out.close();
    } catch (IOException e) {
      System.out.println("以下是错误讯息: " + e.getMessage());
    } 
  }
  
  public static void initCharStatus(L1PcInstance pc, int inithp, int initmp, int str, int intel, int wis, int dex, int con, int cha) {
    pc.addBaseMaxHp((short)(inithp - pc.getBaseMaxHp()));
    pc.addBaseMaxMp((short)(initmp - pc.getBaseMaxMp()));
    pc.addBaseStr((byte)(str - pc.getBaseStr()));
    pc.addBaseInt((byte)(intel - pc.getBaseInt()));
    pc.addBaseWis((byte)(wis - pc.getBaseWis()));
    pc.addBaseDex((byte)(dex - pc.getBaseDex()));
    pc.addBaseCon((byte)(con - pc.getBaseCon()));
    pc.addBaseCha((byte)(cha - pc.getBaseCha()));
    pc.getQuest().set_step(85, 0);
    pc.getQuest().set_step(86, 0);
    pc.getQuest().set_step(87, 0);
    pc.getQuest().set_step(88, 0);
    pc.getQuest().set_step(89, 0);
    pc.getQuest().set_step(90, 0);
  }
  
  public static void checkInitPower(L1PcInstance pc) {
    int initpoint = C_CreateChar.ORIGINAL_AMOUNT[pc.getType()];
    String msg0 = "初始能力点数";
    String msg2 = String.valueOf(initpoint - pc.getTempInitPoint());
    String msg3 = "请选择想要提升的属性：";
    if (initpoint - pc.getTempInitPoint() > 0) {
      String[] msgs = { "初始能力点数", msg2, "请选择想要提升的属性：" };
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "charreset1", msgs));
    } else {
      if (pc.getLevel() == 1)
        CharacterTable.saveCharStatus(pc); 
      checkLevelUp(pc);
    } 
  }
  
  private static void checkLevelUp(L1PcInstance pc) {
    String msg0 = "提升等级";
    String msg2 = "0";
    String msg3 = "要提升多少等级呢?";
    String msg4 = "";
    String msg5 = "";
    if (pc.getTempMaxLevel() - pc.getTempLevel() > 10 && pc.getTempLevel() + 10 < 51) {
      msg4 = "提升 1 级";
      msg5 = "提升 10 级";
    } else {
      msg4 = "提升 1 级";
      msg5 = "";
    } 
    if (pc.getTempMaxLevel() - pc.getTempLevel() > 0 && pc.getTempLevel() < 50) {
      String[] msgs = { "提升等级", "0", "要提升多少等级呢?", msg4, msg5 };
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "charreset2", msgs));
    } else {
      checkBonusPower(pc);
    } 
  }
  
  private static void checkBonusPower(L1PcInstance pc) {
    String msg0 = "等级奖励点数";
    String msg2 = String.valueOf(pc.getTempMaxLevel() - pc.getTempLevel());
    String msg3 = "请选择想要提升的属性：";
    if (pc.getTempMaxLevel() - pc.getTempLevel() > 0) {
      String[] msgs = { "等级奖励点数", msg2, "请选择想要提升的属性：" };
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "charreset3", msgs));
    } else {
      checkElixirPower(pc);
    } 
  }
  
  private static void checkElixirPower(L1PcInstance pc) {
    String msg0 = "万能药点数";
    String msg2 = String.valueOf(pc.getElixirStats() - pc.getTempElixirstats());
    String msg3 = "请选择想要提升的属性：";
    String msg4 = "力量";
    String msg5 = "智力";
    String msg6 = "精神";
    String msg7 = "敏捷";
    String msg8 = "体质";
    String msg9 = "魅力";
    if (pc.getElixirStats() - pc.getTempElixirstats() > 0) {
      String[] msgs = { msg0, msg2, msg3, "力量", "智力", "精神", "敏捷", "体质", "魅力" };
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "charreset4", msgs));
    } else {
      msg0 = "重置完成。";
      msg2 = String.valueOf(pc.getElixirStats() - pc.getTempElixirstats());
      msg3 = "已完成所有点数的分配！";
      String[] msgs = { msg0, msg2, msg3 };
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "charreset5", msgs));
    } 
  }
  
  private static void saveNewCharStatus(L1PcInstance pc) {
    pc.getInventory().consumeItem(49142, 1L);
    pc.setInCharReset(false);
    pc.refresh();
    pc.setExp(pc.getoldexp());
    pc.setCurrentHp(pc.getMaxHp());
    pc.setCurrentMp(pc.getMaxMp());
    if (pc.getTempMaxLevel() != pc.getLevel()) {
      pc.setLevel(pc.getTempMaxLevel());
      pc.setExp(ExpTable.getExpByLevel(pc.getTempMaxLevel()));
    } 
    pc.setTempMaxLevel(0);
    if (pc.getLevel() > 50) {
      pc.setBonusStats(pc.getLevel() - 50);
    } else {
      pc.setBonusStats(0);
    } 
    pc.sendPackets((ServerBasePacket)new S_Paralysis(4, false));
    try {
      pc.save();
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    L1Teleport.teleport(pc, 32628, 32772, (short)4, 4, false);
    RecordTable.get().reshp1(pc.getName());
    pc.sendPackets((ServerBasePacket)new S_SPMR(pc));
    pc.sendPackets((ServerBasePacket)new S_OwnCharStatus(pc));
    pc.sendPackets((ServerBasePacket)new S_PacketBox(132, pc.getEr()));
    L1PolyMorph.undoPoly((L1Character)pc);
    RecordTable.get().reshp1(pc.getName());
    if (ConfigOther.restsavepclog) {
      pc.setsavepclog((int)pc.getExp());
      pc.setExp(1L);
      try {
        Thread.sleep(1000L);
      } catch (Exception exception) {}
      pc.setExp(pc.gesavepclog());
    } 
    pc.onChangeExp();
  }
  
  public static void clanLevel(L1PcInstance pc, int yy) {
    if (yy == 1) {
      leverUpClan(pc);
    } else if (yy == 3) {
      if (pc.getQuest().get_step(8541) == 10) {
        pc.sendPackets((ServerBasePacket)new S_SystemMessage("今日贡献金币已达上限"));
        return;
      } 
      if (!pc.getClanname().equals(pc.getClanNameContribution()))
        pc.setClanNameContribution(pc.getClanname()); 
      if (pc.getQuest().get_step(8541) == 0) {
        pc.getQuest().set_step(8541, 1);
      } else if (pc.getQuest().get_step(8541) == 1) {
        pc.getQuest().set_step(8541, 2);
      } else if (pc.getQuest().get_step(8541) == 2) {
        pc.getQuest().set_step(8541, 3);
      } else if (pc.getQuest().get_step(8541) == 3) {
        pc.getQuest().set_step(8541, 4);
      } else if (pc.getQuest().get_step(8541) == 4) {
        pc.getQuest().set_step(8541, 5);
      } else if (pc.getQuest().get_step(8541) == 5) {
        pc.getQuest().set_step(8541, 6);
      } else if (pc.getQuest().get_step(8541) == 6) {
        pc.getQuest().set_step(8541, 7);
      } else if (pc.getQuest().get_step(8541) == 7) {
        pc.getQuest().set_step(8541, 8);
      } else if (pc.getQuest().get_step(8541) == 8) {
        pc.getQuest().set_step(8541, 9);
      } else if (pc.getQuest().get_step(8541) == 9) {
        pc.getQuest().set_step(8541, 10);
      } 
      L1Clan clan3 = WorldClan.get().getClan(pc.getClanname());
      pc.setclanadena(pc.getclanadena() + ConfigClan.PcClanAdena);
      clan3.setclanadena(clan3.getclanadena() + ConfigClan.PcClanAdena);
      pc.getInventory().consumeItem(40308, ConfigClan.PcClanAdena);
      ClanTable.getInstance().updateClan(clan3);
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("你给予目前的血盟资金有【" + pc.getclanadena() + "】。"));
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("你的血盟目前所获得的资金总合:【" + clan3.getclanadena() + "】。"));
    } else if (yy == 5) {
      if (pc.getQuest().get_step(8545) == 1) {
        pc.sendPackets((ServerBasePacket)new S_SystemMessage("元宝贡献能量今日已达上限"));
        return;
      } 
      if (!pc.getClanname().equals(pc.getClanNameContribution()))
        pc.setClanNameContribution(pc.getClanname()); 
      L1Clan clan3 = WorldClan.get().getClan(pc.getClanname());
      clan3.setClanContribution(clan3.getClanContribution() + ConfigClan.ClanContribution);
      ClanTable.getInstance().updateClan(clan3);
      pc.setClanContribution(pc.getClanContribution() + ConfigClan.ClanContribution);
      pc.getInventory().storeItem(92164, ConfigClan.ClanContribution);
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("获得血盟贡献币:【" + ConfigClan.ClanContribution + "】个。"));
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("你给予目前的血盟贡献度有【" + pc.getClanContribution() + "】点。"));
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("你的血盟目前所获得的贡献度总合有【" + clan3.getClanContribution() + "】点。"));
      pc.getQuest().set_step(8545, 1);
      pc.getInventory().consumeItem(44070, ConfigClan.ClanItem44070);
    } else if (yy == 6) {
      if (pc.getQuest().get_step(8546) == 1) {
        pc.sendPackets((ServerBasePacket)new S_SystemMessage("元宝贡献金币今日已达上限"));
        return;
      } 
      if (!pc.getClanname().equals(pc.getClanNameContribution()))
        pc.setClanNameContribution(pc.getClanname()); 
      L1Clan clan3 = WorldClan.get().getClan(pc.getClanname());
      clan3.setclanadena(clan3.getclanadena() + ConfigClan.ClanContribution_1);
      ClanTable.getInstance().updateClan(clan3);
      pc.setclanadena(pc.getclanadena() + ConfigClan.ClanContribution_1);
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("你给予目前的血盟资金有:【" + pc.getclanadena() + "】。"));
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("你的血盟目前所获得的资金总合有【" + clan3.getclanadena() + "】。"));
      pc.getQuest().set_step(8546, 1);
      pc.getInventory().consumeItem(44070, ConfigClan.ClanItem44070_1);
    } 
  }
  
  private static void leverUpClan(L1PcInstance pc) {
    if (pc.getClanid() == 0) {
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("血盟等级升级必须先拥有血盟喔。"));
      return;
    } 
    L1Clan clan = WorldClan.get().getClan(pc.getClanname());
    if (clan == null) {
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("查无血盟。"));
      return;
    } 
    if (clan.getClanLevel() >= ConfigClan.CLAN_MAX_LEVEL.intValue()) {
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("你所属的血盟已强化至最高等级。"));
      return;
    } 
    if (checkClanLevelUpCondition(pc, clan).booleanValue()) {
      consumeInventoryItems(pc, clan);
      leverUpClan(pc, clan);
    } 
  }
  
  private static Boolean checkClanLevelUpCondition(L1PcInstance pc, L1Clan clanBean) {
    ClanLevelUpCondition condition = ConfigClan.clansLevelUpCondition.get(clanBean.getClanLevel());
    if (condition.getClanEnergy().intValue() > clanBean.getClanContribution()) {
      pc.sendPackets((ServerBasePacket)new S_ServerMessage(String.format("血盟能量不足%s个", new Object[] { condition.getClanAdena() })));
      return Boolean.FALSE;
    } 
    if (condition.getClanAdena().intValue() > clanBean.getclanadena()) {
      pc.sendPackets((ServerBasePacket)new S_ServerMessage(String.format("血盟金币不足%s个", new Object[] { condition.getClanAdena() })));
      return Boolean.FALSE;
    } 
    for (Map.Entry<Integer, Integer> entry : (Iterable<Map.Entry<Integer, Integer>>)condition.getMaterials().entrySet()) {
      L1ItemInstance inventoryItem = pc.getInventory().findItemId(((Integer)entry.getKey()).intValue());
      L1Item consumeItem = ItemTable.get().getTemplate(((Integer)entry.getKey()).intValue());
      if (inventoryItem == null) {
        pc.sendPackets((ServerBasePacket)new S_ServerMessage(String.format("缺少%s(%s)", new Object[] { consumeItem.getName(), entry.getValue() })));
        return Boolean.FALSE;
      } 
      if (inventoryItem.getCount() < ((Integer)entry.getValue()).intValue()) {
        pc.sendPackets((ServerBasePacket)new S_ServerMessage(String.format("%s数量不足(%s)", new Object[] { consumeItem.getName(), entry.getValue() })));
        return Boolean.FALSE;
      } 
    } 
    return Boolean.TRUE;
  }
  
  private static void consumeInventoryItems(L1PcInstance pc, L1Clan clanBean) {
    ClanLevelUpCondition condition = ConfigClan.clansLevelUpCondition.get(clanBean.getClanLevel());
    condition.getMaterials().forEach((itemId, itemCount) -> {
        
        });
  }
  
  private static void leverUpClan(L1PcInstance pc, L1Clan clanBean) {
    ClanLevelUpCondition condition = ConfigClan.clansLevelUpCondition.get(clanBean.getClanLevel());
    int newClanLevel = clanBean.getClanLevel() + 1;
    clanBean.setClanLevel(newClanLevel);
    clanBean.setClanContribution(clanBean.getClanContribution() - condition.getClanEnergy().intValue());
    clanBean.setclanadena(clanBean.getclanadena() - condition.getClanAdena().intValue());
    ClanTable.getInstance().updateClan(clanBean);
    pc.sendPackets((ServerBasePacket)new S_SystemMessage("你的血盟等级已强化为 " + newClanLevel + " 级。"));
    L1PcInstance[] clanMember = clanBean.getOnlineClanMember();
    if (clanMember.length > 0)
      pc.sendPackets(
          (ServerBasePacket)new S_SystemMessage("你所属的血盟(" + pc.getClanname() + ")等级已强化为 " + newClanLevel + " 级")); 
  }
  
  private static void newai(L1PcInstance pc) {
    String[] info = new String[34];
    info[1] = String.valueOf(pc.getnewai1());
    info[2] = String.valueOf(pc.getnewai2());
    info[3] = String.valueOf(pc.getnewai3());
    info[4] = String.valueOf(pc.getnewai4());
    info[5] = String.valueOf(pc.getnewai5());
    info[6] = String.valueOf(pc.getnewai6());
    switch (_random.nextInt(10) + 1) {
      case 1:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai", info));
        break;
      case 2:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai1", info));
        break;
      case 3:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai2", info));
        break;
      case 4:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai3", info));
        break;
      case 5:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai4", info));
        break;
      case 6:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai5", info));
        break;
      case 7:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai6", info));
        break;
      case 8:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai7", info));
        break;
      case 9:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai8", info));
        break;
      case 10:
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "newai9", info));
        break;
    } 
  }
  
  public L1PcInstance get_pc() {
    return this._pc;
  }
  
  public void action(String cmd, long amount) {
    try {
      if (this._pc.isInCharReset()) {
        String str;
        switch ((str = cmd).hashCode()) {
          case 49:
            if (!str.equals("1"))
              break; 
            if (checkvalid(this._pc, cmd))
              setLevelUp(this._pc, 1); 
            checkLevelUp(this._pc);
            break;
          case 1567:
            if (!str.equals("10"))
              break; 
            if (checkvalid(this._pc, cmd))
              setLevelUp(this._pc, 10); 
            checkLevelUp(this._pc);
            break;
          case 2524:
            if (!str.equals("OK"))
              break; 
            saveNewCharStatus(this._pc);
            break;
          case 67708:
            if (!str.equals("Cha"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.addBaseCha(1);
              setLevelUp(this._pc, 1);
            } 
            checkBonusPower(this._pc);
            break;
          case 67938:
            if (!str.equals("Con"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.addBaseCon(1);
              setLevelUp(this._pc, 1);
            } 
            checkBonusPower(this._pc);
            break;
          case 68599:
            if (!str.equals("Dex"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.addBaseDex(1);
              setLevelUp(this._pc, 1);
            } 
            checkBonusPower(this._pc);
            break;
          case 73679:
            if (!str.equals("Int"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.addBaseInt(1);
              setLevelUp(this._pc, 1);
            } 
            checkBonusPower(this._pc);
            break;
          case 83473:
            if (!str.equals("Str"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.addBaseStr(1);
              setLevelUp(this._pc, 1);
            } 
            checkBonusPower(this._pc);
            break;
          case 86977:
            if (!str.equals("Wis"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.addBaseWis(1);
              setLevelUp(this._pc, 1);
            } 
            checkBonusPower(this._pc);
            break;
          case 96918249:
            if (!str.equals("exCha"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempElixirstats(this._pc.getTempElixirstats() + 1);
              this._pc.addBaseCha(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkElixirPower(this._pc);
            break;
          case 96918479:
            if (!str.equals("exCon"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempElixirstats(this._pc.getTempElixirstats() + 1);
              this._pc.addBaseCon(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkElixirPower(this._pc);
            break;
          case 96919140:
            if (!str.equals("exDex"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempElixirstats(this._pc.getTempElixirstats() + 1);
              this._pc.addBaseDex(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkElixirPower(this._pc);
            break;
          case 96924220:
            if (!str.equals("exInt"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempElixirstats(this._pc.getTempElixirstats() + 1);
              this._pc.addBaseInt(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkElixirPower(this._pc);
            break;
          case 96934014:
            if (!str.equals("exStr"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempElixirstats(this._pc.getTempElixirstats() + 1);
              this._pc.addBaseStr(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkElixirPower(this._pc);
            break;
          case 96937518:
            if (!str.equals("exWis"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempElixirstats(this._pc.getTempElixirstats() + 1);
              this._pc.addBaseWis(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkElixirPower(this._pc);
            break;
          case 1948305772:
            if (!str.equals("initCha"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempInitPoint(this._pc.getTempInitPoint() + 1);
              this._pc.addBaseCha(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkInitPower(this._pc);
            break;
          case 1948306002:
            if (!str.equals("initCon"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempInitPoint(this._pc.getTempInitPoint() + 1);
              this._pc.addBaseCon(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkInitPower(this._pc);
            break;
          case 1948306663:
            if (!str.equals("initDex"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempInitPoint(this._pc.getTempInitPoint() + 1);
              this._pc.addBaseDex(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkInitPower(this._pc);
            break;
          case 1948311743:
            if (!str.equals("initInt"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempInitPoint(this._pc.getTempInitPoint() + 1);
              this._pc.addBaseInt(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkInitPower(this._pc);
            break;
          case 1948321537:
            if (!str.equals("initStr"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempInitPoint(this._pc.getTempInitPoint() + 1);
              this._pc.addBaseStr(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkInitPower(this._pc);
            break;
          case 1948325041:
            if (!str.equals("initWis"))
              break; 
            if (checkvalid(this._pc, cmd)) {
              this._pc.setTempInitPoint(this._pc.getTempInitPoint() + 1);
              this._pc.addBaseWis(1);
              this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus2(this._pc));
            } 
            checkInitPower(this._pc);
            break;
        } 
        return;
      } 
      if (this._pc.isShapeChange()) {
        this._pc.get_other().set_gmHtml(null);
        int awakeSkillId = this._pc.getAwakeSkillId();
        if (awakeSkillId == 185 || awakeSkillId == 190 || awakeSkillId == 195) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage(1384));
          return;
        } 
        L1PolyMorph.handleCommands(this._pc, cmd);
        this._pc.setShapeChange(false);
        this._pc.setSummonMonster(false);
        return;
      } 
      if (this._pc.isItemPoly()) {
        L1ItemInstance item = this._pc.getPolyScroll();
        L1PolyMorph poly = PolyTable.get().getTemplate(cmd);
        if (poly != null || cmd.equals("none")) {
          if (item.getItemId() == 44212 || (item.getItemId() >= 80057 && item.getItemId() <= 80066)) {
            usePolyBook(this._pc, item, cmd);
            return;
          } 
          if (item.getItemId() >= 80067 && item.getItemId() <= 80070) {
            usePolyBookcouitem(this._pc, item, cmd);
            return;
          } 
          usePolyScroll(this._pc, item, cmd);
          return;
        } 
      } 
      if (this._pc.isPhantomTeleport()) {
        usePhantomTeleport(this._pc, cmd);
        return;
      } 
      if (this._pc.get_other().get_gmHtml() != null) {
        this._pc.get_other().get_gmHtml().action(cmd);
        return;
      } 
      if (AutoAttackUpdate.getInstance().PcCommand(this._pc, cmd))
        return; 
      if (AutoAttackUpdateNew.getInstance().PcCommand(this._pc, cmd))
        return; 
      if (TFUpdate.getInstance().PcCommand(this._pc, cmd))
        return; 
      if (CardBookCmd.get().Cmd(this._pc, cmd))
        return; 
      if (CardBookCmd.get().PolyCmd(this._pc, cmd))
        return; 
      if (FollowAutoAttackUpdate.getInstance().PcCommand(this._pc, cmd))
        return; 
      if (ItemActionPoly.forNpcQuest(cmd, this._pc))
        return; 
      L1ItemInstance item2 = this._pc.getPolyScrol2();
      if (ItemAction.forNpcQuest(cmd, this._pc, item2))
        return; 
      if (ItemShop.forNpcQuest(cmd, this._pc))
        return; 
      if (L1Yiwa.yiwa(cmd, this._pc))
        return; 
      if (L1Shaha.shaha(cmd, this._pc))
        return; 
      if (L1Pageliao.pageliao(cmd, this._pc))
        return; 
      if (L1Mapule.mapule(cmd, this._pc))
        return; 
      if (L1Yinhaisa.yinhaisa(cmd, this._pc))
        return; 
      if (L1Gelanken.gelanken(cmd, this._pc))
        return; 
      this._pc.get_other().set_gmHtml(null);
      if (this._pc.isGm())
        if (cmd.equals("tp_refresh")) {
          L1ToPC2.checkTPhtmlPredicate(this._pc, 0, true);
        } else if (cmd.equals("tp_refresh_map")) {
          L1ToPC2.checkTPhtmlPredicate(this._pc, 0, false);
        } else if (cmd.equals("tp_page_up")) {
          L1ToPC2.checkTPhtml(this._pc, this._pc.get_other().get_page() - 1);
        } else if (cmd.equals("tp_page_down")) {
          L1ToPC2.checkTPhtml(this._pc, this._pc.get_other().get_page() + 1);
        } else if (cmd.matches("tp_[0-9]+")) {
          int index = Integer.parseInt(cmd.substring(3));
          L1ToPC2.teleport2Player(this._pc, index);
        }  
      if (cmd.equalsIgnoreCase("power")) {
        if (this._pc.power())
          this._pc.sendPackets((ServerBasePacket)new S_Bonusstats(this._pc.getId())); 
        this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("\\fU请输入玩家名称。"));
      } else if (cmd.equalsIgnoreCase("bad_3")) {
        this._pc.setKeyInEnemy(true);
        this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("\\fU请输入玩家名称。"));
      } else if (cmd.equalsIgnoreCase("bad_4")) {
        this._pc.setKeyOutEnemy(true);
        this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("\\fU请输入玩家名称。"));
      } else if (cmd.equalsIgnoreCase("bad_5")) {
        BadEnemyList(this._pc);
      } else if (cmd.equalsIgnoreCase("clanlv1")) {
        if (this._pc.isCrown()) {
          if (this._pc.getClan() == null) {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("血盟等级升级必须先拥有血盟喔。"));
          } else {
            clanLevel(this._pc, 1);
            L1Clan clan = WorldClan.get().getClan(this._pc.getClanname());
            String[] info = new String[7];
            if (this._pc.getClanid() > 0) {
              info[0] = String.valueOf(this._pc.getClanname());
            } else {
              info[0] = "无";
            } 
            if (this._pc.getClanid() > 0) {
              info[1] = String.valueOf(clan.getClanLevel());
            } else {
              info[1] = "无";
            } 
            if (this._pc.getClanid() > 0) {
              info[2] = String.valueOf(clan.getClanContribution());
            } else {
              info[2] = "无";
            } 
            info[3] = String.valueOf(this._pc.getPcContribution());
            info[4] = String.valueOf(this._pc.getClanContribution());
            info[5] = String.valueOf(this._pc.getclanadena());
            info[6] = String.valueOf(clan.getclanadena());
            this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "clanlvadd", info));
          } 
        } else {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("你的职业无法强化血盟等级。"));
        } 
      } else if (cmd.equals("deletebook")) {
        this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("请输入删除座标名称(60秒内)"));
        this._pc.setSkillEffect(95133, 60000);
      } else if (cmd.equals("clanlv3")) {
        if (this._pc.getClan() == null) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("想要贡献必须先拥有血盟喔。"));
        } else if (this._pc.getInventory().checkItem(40308, ConfigClan.PcClanAdena)) {
          if (this._pc.getLevel() >= ConfigClan.clanlevel) {
            clanLevel(this._pc, 3);
            L1Clan clan = WorldClan.get().getClan(this._pc.getClanname());
            String[] info = new String[7];
            if (this._pc.getClanid() > 0) {
              info[0] = String.valueOf(this._pc.getClanname());
            } else {
              info[0] = "无";
            } 
            if (this._pc.getClanid() > 0) {
              info[1] = String.valueOf(clan.getClanLevel());
            } else {
              info[1] = "无";
            } 
            if (this._pc.getClanid() > 0) {
              info[2] = String.valueOf(clan.getClanContribution());
            } else {
              info[2] = "无";
            } 
            info[3] = String.valueOf(this._pc.getPcContribution());
            info[4] = String.valueOf(this._pc.getClanContribution());
            info[5] = String.valueOf(this._pc.getclanadena());
            info[6] = String.valueOf(clan.getclanadena());
            this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "clanlvadd", info));
          } else {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage(ConfigClan.clanmsg1));
          } 
        } else {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("金币不足无法帮助你的血盟喔。"));
        } 
      } else if (cmd.equals("clanlv5")) {
        if (this._pc.getClan() == null) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("想要贡献必须先拥有血盟喔。"));
        } else if (this._pc.getInventory().checkItem(44070, ConfigClan.ClanItem44070)) {
          if (this._pc.getLevel() >= ConfigClan.clanlevel) {
            clanLevel(this._pc, 5);
            L1Clan clan = WorldClan.get().getClan(this._pc.getClanname());
            String[] info = new String[7];
            if (this._pc.getClanid() > 0) {
              info[0] = String.valueOf(this._pc.getClanname());
            } else {
              info[0] = "无";
            } 
            if (this._pc.getClanid() > 0) {
              info[1] = String.valueOf(clan.getClanLevel());
            } else {
              info[1] = "无";
            } 
            if (this._pc.getClanid() > 0) {
              info[2] = String.valueOf(clan.getClanContribution());
            } else {
              info[2] = "无";
            } 
            info[3] = String.valueOf(this._pc.getPcContribution());
            info[4] = String.valueOf(this._pc.getClanContribution());
            info[5] = String.valueOf(this._pc.getclanadena());
            info[6] = String.valueOf(clan.getclanadena());
            this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "clanlvadd", info));
          } else {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage(ConfigClan.clanmsg1));
          } 
        } else {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("元宝不足无法帮助你的血盟喔。"));
        } 
      } else if (cmd.equals("clanlv6")) {
        if (this._pc.getClan() == null) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("想要贡献必须先拥有血盟喔。"));
        } else if (this._pc.getInventory().checkItem(44070, ConfigClan.ClanItem44070_1)) {
          if (this._pc.getLevel() >= ConfigClan.clanlevel) {
            clanLevel(this._pc, 6);
            L1Clan clan = WorldClan.get().getClan(this._pc.getClanname());
            String[] info = new String[7];
            if (this._pc.getClanid() > 0) {
              info[0] = String.valueOf(this._pc.getClanname());
            } else {
              info[0] = "无";
            } 
            if (this._pc.getClanid() > 0) {
              info[1] = String.valueOf(clan.getClanLevel());
            } else {
              info[1] = "无";
            } 
            if (this._pc.getClanid() > 0) {
              info[2] = String.valueOf(clan.getClanContribution());
            } else {
              info[2] = "无";
            } 
            info[3] = String.valueOf(this._pc.getPcContribution());
            info[4] = String.valueOf(this._pc.getClanContribution());
            info[5] = String.valueOf(this._pc.getclanadena());
            info[6] = String.valueOf(clan.getclanadena());
            this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "clanlvadd", info));
          } else {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage(ConfigClan.clanmsg1));
          } 
        } else {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("元宝不足无法帮助你的血盟喔。"));
        } 
      } else if (cmd.equalsIgnoreCase("xsmb")) {
        this._pc.set_allclanbid(!this._pc.is_allclanbid());
        this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("\\fT盟徽显示开启！"));
        String clanname = (this._pc.getClanname() != null) ? this._pc.getClanname() : "";
        if (this._pc.is_allclanbid()) {
          try {
            for (L1Clan clan : WorldClan.get().getAllClans()) {
              if ("".equals(clanname)) {
                this._pc.sendPackets((ServerBasePacket)new S_War(1, "", clan.getClanName()));
                continue;
              } 
              this._pc.sendPackets((ServerBasePacket)new S_War(1, clanname, clan.getClanName()));
            } 
          } catch (Exception e) {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("\\aD没加入血盟，你显示个毛线盟标！"));
            e.printStackTrace();
          } 
        } else {
          for (L1Clan clan : WorldClan.get().getAllClans())
            this._pc.sendPackets((ServerBasePacket)new S_War(3, clanname, clan.getClanName())); 
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("\\fY盟徽显示关闭！"));
        } 
      } else if (cmd.equalsIgnoreCase("cleanaiq")) {
        this._pc.setnewai4(0);
        this._pc.setnewai5(0);
        this._pc.setnewai6(0);
        newai(this._pc);
      } else if (cmd.equalsIgnoreCase("1q")) {
        this._pc.setnewaiq1(1);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq1());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq1());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq1());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("2q")) {
        this._pc.setnewaiq2(2);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq2());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq2());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq2());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("3q")) {
        this._pc.setnewaiq3(3);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq3());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq3());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq3());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("4q")) {
        this._pc.setnewaiq4(4);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq4());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq4());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq4());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.setSkillEffect(6930, 1200000);
          this._pc.killSkillEffectTimer(6933);
        } 
      } else if (cmd.equalsIgnoreCase("5q")) {
        this._pc.setnewaiq5(5);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq5());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq5());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq5());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("6q")) {
        this._pc.setnewaiq6(6);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq6());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq6());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq6());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("7q")) {
        this._pc.setnewaiq7(7);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq7());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq7());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq7());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("8q")) {
        this._pc.setnewaiq8(8);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq8());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq8());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq8());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("9q")) {
        this._pc.setnewaiq9(9);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq9());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq9());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq9());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("0q")) {
        this._pc.setnewaiq0(0);
        if (this._pc.getnewai4() == 0) {
          this._pc.setnewai4(this._pc.getnewaiq1());
        } else if (this._pc.getnewai5() == 0) {
          this._pc.setnewai5(this._pc.getnewaiq1());
        } else if (this._pc.getnewai6() == 0) {
          this._pc.setnewai6(this._pc.getnewaiq1());
        } 
        newai(this._pc);
        if (this._pc.getnewai4() == this._pc.getnewai1() && this._pc.getnewai5() == this._pc.getnewai2() && 
          this._pc.getnewai6() == this._pc.getnewai3()) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("恭喜您验证成功"));
          this._pc.setnewai4(0);
          this._pc.setnewai5(0);
          this._pc.setnewai6(0);
          this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
          this._pc.killSkillEffectTimer(6933);
          this._pc.setSkillEffect(6930, 1200000);
        } 
      } else if (cmd.equalsIgnoreCase("locerr1")) {
        if (this._pc.isParalyzed() || this._pc.isSleeped() || this._pc.isParalyzedX())
          return; 
        if (this._pc.isDead())
          return; 
        if (this._pc.isInvisble())
          return; 
        if (this._pc.hasSkillEffect(4000))
          return; 
        if (this._pc.hasSkillEffect(33) || this._pc.hasSkillEffect(50) || this._pc.hasSkillEffect(66) || 
          this._pc.hasSkillEffect(87))
          return; 
        if (this._pc.hasSkillEffect(1011))
          return; 
        if (this._pc.hasSkillEffect(157))
          return; 
        if (this._pc.hasSkillEffect(1009))
          return; 
        if (this._pc.hasSkillEffect(4017))
          return; 
        if (this._pc.hasSkillEffect(192))
          return; 
        if (this._pc.hasSkillEffect(87))
          return; 
        if (this._pc.hasSkillEffect(208))
          return; 
        if (this._pc.hasSkillEffect(1011))
          return; 
        if (this._pc.hasSkillEffect(1009))
          return; 
        if (this._pc.hasSkillEffect(55889)) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("无法连续使用该功能"));
          return;
        } 
        this._pc.setSkillEffect(55889, 30000);
        this._pc.set_unfreezingTime(5);
      } else if (cmd.equalsIgnoreCase("locerr2")) {
        if (this._pc.isParalyzed() || this._pc.isSleeped() || this._pc.isParalyzedX())
          return; 
        if (this._pc.isDead())
          return; 
        if (this._pc.isInvisble())
          return; 
        if (this._pc.hasSkillEffect(4000))
          return; 
        if (this._pc.hasSkillEffect(33) || this._pc.hasSkillEffect(50) || this._pc.hasSkillEffect(66) || 
          this._pc.hasSkillEffect(87))
          return; 
        if (this._pc.hasSkillEffect(1011))
          return; 
        if (this._pc.hasSkillEffect(157))
          return; 
        if (this._pc.hasSkillEffect(1009))
          return; 
        if (this._pc.hasSkillEffect(4017))
          return; 
        if (this._pc.hasSkillEffect(192))
          return; 
        if (this._pc.hasSkillEffect(87))
          return; 
        if (this._pc.hasSkillEffect(208))
          return; 
        if (this._pc.hasSkillEffect(1011))
          return; 
        if (this._pc.hasSkillEffect(1009))
          return; 
        if (this._pc.hasSkillEffect(55889)) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("无法连续使用该功能"));
          return;
        } 
        this._pc.setSkillEffect(55889, 30000);
        this._pc.set_misslocTime(3);
      } else if (cmd.equalsIgnoreCase("index")) {
        this._pc.isWindows();
      } else if (cmd.equalsIgnoreCase("gfxid")) {
        if (this._pc.getopengfxid()) {
          this._pc.setopengfxid(false);
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("关闭-画面中玩家特效"));
        } else {
          this._pc.setopengfxid(true);
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("开启-画面中玩家特效"));
        } 
      } else if (cmd.equalsIgnoreCase("npcdropmenu")) {
        this._pc.setItemName(true);
        this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("\\fY请输入要查询道具名称后，按(Enter)。"));
      } else if (cmd.equalsIgnoreCase("pc_score")) {
        if (this._pc.get_other().get_score() >= 0)
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("\\aD目前阵营积分:" + this._pc.get_other().get_score())); 
      } else if (cmd.equalsIgnoreCase("npcclanbuff")) {
        if (this._pc.hasSkillEffect(95413))
          return; 
        if (this._pc.getClanid() <= 0) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("没有加入血盟，有钱你也无法使用此功能"));
          return;
        } 
        if (this._pc.getInventory().checkItem(ConfigOther.NeedItem, ConfigOther.NeedItemCount)) {
          this._pc.getInventory().consumeItem(ConfigOther.NeedItem, ConfigOther.NeedItemCount);
          this._pc.setSkillEffect(95413, 10000);
          int[] skills = ConfigOther.Give_skill;
          L1Clan clan2 = WorldClan.get().getClan(this._pc.getClanname());
          L1PcInstance[] clanMembers = clan2.getOnlineClanMember();
          int i = 0;
          while (i < skills.length) {
            L1PcInstance[] array;
            int length = (array = clanMembers).length;
            int j = 0;
            while (j < length) {
              L1PcInstance clanMember1 = array[j];
              L1Skills skill = SkillsTable.get().getTemplate(skills[i]);
              L1SkillUse skillUse = new L1SkillUse();
              skillUse.handleCommands(clanMember1, skills[i], clanMember1.getId(), clanMember1.getX(), 
                  clanMember1.getY(), skill.getBuffDuration(), 4);
              j++;
            } 
            i++;
          } 
          L1PcInstance[] onlineClanMember;
          int k = (onlineClanMember = clan2.getOnlineClanMember()).length;
          int l = 0;
          while (l < k) {
            L1PcInstance clanMembers2 = onlineClanMember[l];
            clanMembers2
              .sendPackets((ServerBasePacket)new S_SystemMessage(String.format(ConfigOther.Msg, new Object[] { this._pc.getName() })));
            l++;
          } 
        } else {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage(ConfigOther.ItemMsg));
        } 
      } else if (cmd.equalsIgnoreCase("npcallbuff")) {
        if (this._pc.hasSkillEffect(95413))
          return; 
        this._pc.setSkillEffect(95413, 10000);
        if (this._pc.getInventory().checkItem(ConfigOther.NeedItem1, ConfigOther.NeedItemCount1)) {
          World.get().broadcastPacketToAll(
              (ServerBasePacket)new S_SystemMessage(String.format(ConfigOther.Msg1, new Object[] { this._pc.getName() })));
          this._pc.getInventory().consumeItem(ConfigOther.NeedItem1, ConfigOther.NeedItemCount1);
          AllBuffRunnable allBuffRunnable = new AllBuffRunnable();
          GeneralThreadPool.get().execute(allBuffRunnable);
          try {
            Thread.sleep(1000L);
          } catch (InterruptedException e) {
            e.printStackTrace();
          } 
        } else {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage(ConfigOther.ItemMsg1));
        } 
      } else if (cmd.equalsIgnoreCase("pcbuff1")) {
        if (this._pc.hasSkillEffect(95413))
          return; 
        this._pc.setSkillEffect(95413, 10000);
        if (this._pc.getInventory().checkItem(ConfigOther.NeedItem2, ConfigOther.NeedItemCount2)) {
          this._pc.getInventory().consumeItem(ConfigOther.NeedItem2, ConfigOther.NeedItemCount2);
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage(ConfigOther.Msg2));
          int[] skills = ConfigOther.Give_skill2;
          int j = 0;
          while (j < skills.length) {
            L1Skills skill2 = SkillsTable.get().getTemplate(skills[j]);
            L1SkillUse skillUse2 = new L1SkillUse();
            skillUse2.handleCommands(this._pc, skills[j], this._pc.getId(), this._pc.getX(), 
                this._pc.getY(), skill2.getBuffDuration(), 4);
            j++;
          } 
        } else {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage(ConfigOther.ItemMsg2));
        } 
      } else if (cmd.equalsIgnoreCase("kor_meau")) {
        if (this._pc.isActived()) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("挂机中无法使用开关"));
          return;
        } 
        String type1 = "";
        String type2 = "";
        String type3 = "";
        String type4 = "";
        String type5 = "";
        if (this._pc.hasSkillEffect(1688)) {
          type1 = "开启";
        } else {
          type1 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1689)) {
          type2 = "开启";
        } else {
          type2 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1690)) {
          type3 = "开启";
        } else {
          type3 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1691)) {
          type4 = "开启";
        } else {
          type4 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1692)) {
          type5 = "开启";
        } else {
          type5 = "关闭";
        } 
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "pconly3", 
              new String[] { type1, type2, type3, type4, type5 }));
      } else if (cmd.equalsIgnoreCase("showPrestige")) {
          if (this._pc.isActived()) {
              this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("挂机中无法使用开关"));
              return;
            } 
          this._pc.set_prestigeName();
          String type1 = this._pc.get_prestigeName();
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "showPristige", 
                  new String[] { type1}));
      }else if (cmd.equalsIgnoreCase("showrebornlv")) {
          if (this._pc.isActived()) {
              this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("挂机中无法使用开关"));
              return;
            } 
          this._pc.set_rebornLVName();
          String type1 = this._pc.get_rebornLVName();
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "showreborn", 
                  new String[] { type1}));
      } else if (cmd.equalsIgnoreCase("aa")) {
        boolean isTalent = false;
        if (this._pc.getlogpcpower_SkillCount() > 0)
          isTalent = true; 
        if (isTalent)
          if (this._pc.getlogpcpower_SkillFor1() >= 10) {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("该天赋技能已满"));
            isTalent = false;
          } else {
            this._pc.setlogpcpower_SkillFor1(this._pc.getlogpcpower_SkillFor1() + 1);
            this._pc.setlogpcpower_SkillCount(this._pc.getlogpcpower_SkillCount() - 1);
          }  
        String[] info = new String[6];
        if (this._pc.getlogpcpower_SkillCount() > 0) {
          info[0] = String.valueOf(this._pc.getlogpcpower_SkillCount());
        } else {
          info[0] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor1() > 0) {
          info[1] = String.valueOf(this._pc.getlogpcpower_SkillFor1());
        } else {
          info[1] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor2() > 0) {
          info[2] = String.valueOf(this._pc.getlogpcpower_SkillFor2());
        } else {
          info[2] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor3() > 0) {
          info[3] = String.valueOf(this._pc.getlogpcpower_SkillFor3());
        } else {
          info[3] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor4() > 0) {
          info[4] = String.valueOf(this._pc.getlogpcpower_SkillFor4());
        } else {
          info[4] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor5() > 0) {
          info[5] = String.valueOf(this._pc.getlogpcpower_SkillFor5());
        } else {
          info[5] = "0";
        } 
        if (this._pc.isCrown()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talCrown", info));
        } else if (this._pc.isKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talKnight", info));
        } else if (this._pc.isWizard()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talWizard", info));
        } else if (this._pc.isElf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talElf", info));
        } else if (this._pc.isDarkelf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDarkelf", info));
        } else if (this._pc.isDragonKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDragonK", info));
        } else if (this._pc.isIllusionist()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talIllusi", info));
        } 
      } else if (cmd.equalsIgnoreCase("bb")) {
        boolean isTalent = false;
        if (this._pc.getlogpcpower_SkillCount() > 0)
          isTalent = true; 
        if (isTalent)
          if (this._pc.getlogpcpower_SkillFor2() >= 10) {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("该天赋技能已满"));
            isTalent = false;
          } else {
            this._pc.setlogpcpower_SkillFor2(this._pc.getlogpcpower_SkillFor2() + 1);
            this._pc.setlogpcpower_SkillCount(this._pc.getlogpcpower_SkillCount() - 1);
          }  
        String[] info = new String[6];
        if (this._pc.getlogpcpower_SkillCount() > 0) {
          info[0] = String.valueOf(this._pc.getlogpcpower_SkillCount());
        } else {
          info[0] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor1() > 0) {
          info[1] = String.valueOf(this._pc.getlogpcpower_SkillFor1());
        } else {
          info[1] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor2() > 0) {
          info[2] = String.valueOf(this._pc.getlogpcpower_SkillFor2());
        } else {
          info[2] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor3() > 0) {
          info[3] = String.valueOf(this._pc.getlogpcpower_SkillFor3());
        } else {
          info[3] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor4() > 0) {
          info[4] = String.valueOf(this._pc.getlogpcpower_SkillFor4());
        } else {
          info[4] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor5() > 0) {
          info[5] = String.valueOf(this._pc.getlogpcpower_SkillFor5());
        } else {
          info[5] = "0";
        } 
        if (this._pc.isCrown()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talCrown", info));
        } else if (this._pc.isKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talKnight", info));
        } else if (this._pc.isWizard()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talWizard", info));
        } else if (this._pc.isElf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talElf", info));
        } else if (this._pc.isDarkelf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDarkelf", info));
        } else if (this._pc.isDragonKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDragonK", info));
        } else if (this._pc.isIllusionist()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talIllusi", info));
        } 
      } else if (cmd.equalsIgnoreCase("cc")) {
        boolean isTalent = false;
        if (this._pc.getlogpcpower_SkillCount() > 0)
          isTalent = true; 
        if (isTalent)
          if (this._pc.getlogpcpower_SkillFor3() >= 10) {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("该天赋技能已满"));
            isTalent = false;
          } else {
            this._pc.setlogpcpower_SkillFor3(this._pc.getlogpcpower_SkillFor3() + 1);
            this._pc.setlogpcpower_SkillCount(this._pc.getlogpcpower_SkillCount() - 1);
          }  
        String[] info = new String[6];
        if (this._pc.getlogpcpower_SkillCount() > 0) {
          info[0] = String.valueOf(this._pc.getlogpcpower_SkillCount());
        } else {
          info[0] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor1() > 0) {
          info[1] = String.valueOf(this._pc.getlogpcpower_SkillFor1());
        } else {
          info[1] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor2() > 0) {
          info[2] = String.valueOf(this._pc.getlogpcpower_SkillFor2());
        } else {
          info[2] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor3() > 0) {
          info[3] = String.valueOf(this._pc.getlogpcpower_SkillFor3());
        } else {
          info[3] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor4() > 0) {
          info[4] = String.valueOf(this._pc.getlogpcpower_SkillFor4());
        } else {
          info[4] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor5() > 0) {
          info[5] = String.valueOf(this._pc.getlogpcpower_SkillFor5());
        } else {
          info[5] = "0";
        } 
        if (this._pc.isCrown()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talCrown", info));
        } else if (this._pc.isKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talKnight", info));
        } else if (this._pc.isWizard()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talWizard", info));
        } else if (this._pc.isElf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talElf", info));
        } else if (this._pc.isDarkelf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDarkelf", info));
        } else if (this._pc.isDragonKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDragonK", info));
        } else if (this._pc.isIllusionist()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talIllusi", info));
        } 
      } else if (cmd.equalsIgnoreCase("dd")) {
        boolean isTalent = false;
        if (this._pc.getlogpcpower_SkillCount() > 0)
          isTalent = true; 
        if (isTalent)
          if (this._pc.getlogpcpower_SkillFor4() >= 10) {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("该天赋技能已满"));
            isTalent = false;
          } else {
            this._pc.setlogpcpower_SkillFor4(this._pc.getlogpcpower_SkillFor4() + 1);
            this._pc.setlogpcpower_SkillCount(this._pc.getlogpcpower_SkillCount() - 1);
          }  
        String[] info = new String[6];
        if (this._pc.getlogpcpower_SkillCount() > 0) {
          info[0] = String.valueOf(this._pc.getlogpcpower_SkillCount());
        } else {
          info[0] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor1() > 0) {
          info[1] = String.valueOf(this._pc.getlogpcpower_SkillFor1());
        } else {
          info[1] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor2() > 0) {
          info[2] = String.valueOf(this._pc.getlogpcpower_SkillFor2());
        } else {
          info[2] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor3() > 0) {
          info[3] = String.valueOf(this._pc.getlogpcpower_SkillFor3());
        } else {
          info[3] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor4() > 0) {
          info[4] = String.valueOf(this._pc.getlogpcpower_SkillFor4());
        } else {
          info[4] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor5() > 0) {
          info[5] = String.valueOf(this._pc.getlogpcpower_SkillFor5());
        } else {
          info[5] = "0";
        } 
        if (this._pc.isCrown()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talCrown", info));
        } else if (this._pc.isKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talKnight", info));
        } else if (this._pc.isWizard()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talWizard", info));
        } else if (this._pc.isElf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talElf", info));
        } else if (this._pc.isDarkelf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDarkelf", info));
        } else if (this._pc.isDragonKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDragonK", info));
        } else if (this._pc.isIllusionist()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talIllusi", info));
        } 
      } else if (cmd.equalsIgnoreCase("ee")) {
        boolean isTalent = false;
        if (this._pc.getlogpcpower_SkillCount() > 0)
          isTalent = true; 
        if (isTalent)
          if (this._pc.getlogpcpower_SkillFor5() >= 10) {
            this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("该天赋技能已满"));
            isTalent = false;
          } else {
            this._pc.setlogpcpower_SkillFor5(this._pc.getlogpcpower_SkillFor5() + 1);
            this._pc.setlogpcpower_SkillCount(this._pc.getlogpcpower_SkillCount() - 1);
            if (this._pc.isDragonKnight())
              if (this._pc.getlogpcpower_SkillFor5() == 1) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 2) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 3) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 4) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 5) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 6) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 7) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 8) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 9) {
                this._pc.addMaxHp(400);
              } else if (this._pc.getlogpcpower_SkillFor5() == 10) {
                this._pc.addMaxHp(400);
                this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus(this._pc));
              }  
          }  
        String[] info = new String[6];
        if (this._pc.getlogpcpower_SkillCount() > 0) {
          info[0] = String.valueOf(this._pc.getlogpcpower_SkillCount());
        } else {
          info[0] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor1() > 0) {
          info[1] = String.valueOf(this._pc.getlogpcpower_SkillFor1());
        } else {
          info[1] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor2() > 0) {
          info[2] = String.valueOf(this._pc.getlogpcpower_SkillFor2());
        } else {
          info[2] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor3() > 0) {
          info[3] = String.valueOf(this._pc.getlogpcpower_SkillFor3());
        } else {
          info[3] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor4() > 0) {
          info[4] = String.valueOf(this._pc.getlogpcpower_SkillFor4());
        } else {
          info[4] = "0";
        } 
        if (this._pc.getlogpcpower_SkillFor5() > 0) {
          info[5] = String.valueOf(this._pc.getlogpcpower_SkillFor5());
        } else {
          info[5] = "0";
        } 
        if (this._pc.isCrown()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talCrown", info));
        } else if (this._pc.isKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talKnight", info));
        } else if (this._pc.isWizard()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talWizard", info));
        } else if (this._pc.isElf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talElf", info));
        } else if (this._pc.isDarkelf()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDarkelf", info));
        } else if (this._pc.isDragonKnight()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talDragonK", info));
        } else if (this._pc.isIllusionist()) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "talIllusi", info));
        } 
      } else if (cmd.equalsIgnoreCase("ff")) {
        L1Item temp = ItemTable.get().getTemplate(ConfigOther.recaseff);
        if (!this._pc.getInventory().checkItem(ConfigOther.recaseff, ConfigOther.recaseffcount)) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage(
                String.valueOf(String.valueOf(temp.getName())) + "不足" + ConfigOther.recaseffcount + "个"));
          return;
        } 
        if (this._pc.getMeteLevel() == 0) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("您尚未转身无法重置"));
          return;
        } 
        if (this._pc.getlogpcpower_SkillCount() > 0) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("请先将天赋点数点完"));
          return;
        } 
        this._pc.getInventory().consumeItem(44070, 499L);
        int SkillCount = this._pc.getlogpcpower_SkillFor1() + this._pc.getlogpcpower_SkillFor2() + 
          this._pc.getlogpcpower_SkillFor3() + this._pc.getlogpcpower_SkillFor4() + 
          this._pc.getlogpcpower_SkillFor5();
        this._pc.setlogpcpower_SkillCount(SkillCount);
        if (this._pc.isDragonKnight()) {
          this._pc.addMaxHp(-400 * this._pc.getlogpcpower_SkillFor5());
          this._pc.sendPackets((ServerBasePacket)new S_OwnCharStatus(this._pc));
        } 
        this._pc.setlogpcpower_SkillFor1(0);
        this._pc.setlogpcpower_SkillFor2(0);
        this._pc.setlogpcpower_SkillFor3(0);
        this._pc.setlogpcpower_SkillFor4(0);
        this._pc.setlogpcpower_SkillFor5(0);
        this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("天赋能力已还原"));
        this._pc.sendPackets((ServerBasePacket)new S_CloseList(this._pc.getId()));
      } else if (cmd.equalsIgnoreCase("atkmessage")) {
        if (this._pc.isActived()) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("挂机中无法使用开关"));
          return;
        } 
        if (this._pc.hasSkillEffect(1688)) {
          this._pc.killSkillEffectTimer(1688);
        } else if (!this._pc.hasSkillEffect(1688)) {
          this._pc.setSkillEffect(1688, 0);
        } 
        String type1 = "";
        String type2 = "";
        String type3 = "";
        String type4 = "";
        String type5 = "";
        if (this._pc.hasSkillEffect(1688)) {
          type1 = "开启";
        } else {
          type1 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1689)) {
          type2 = "开启";
        } else {
          type2 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1690)) {
          type3 = "开启";
        } else {
          type3 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1691)) {
          type4 = "开启";
        } else {
          type4 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1692)) {
          type5 = "开启";
        } else {
          type5 = "关闭";
        } 
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "pconly3", 
              new String[] { type1, type2, type3, type4, type5 }));
      } else if (cmd.equalsIgnoreCase("partymessage")) {
        if (this._pc.isActived()) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("挂机中无法使用开关"));
          return;
        } 
        if (this._pc.hasSkillEffect(1689)) {
          this._pc.killSkillEffectTimer(1689);
        } else if (!this._pc.hasSkillEffect(1689)) {
          this._pc.setSkillEffect(1689, 0);
        } 
        String type1 = "";
        String type2 = "";
        String type3 = "";
        String type4 = "";
        String type5 = "";
        if (this._pc.hasSkillEffect(1688)) {
          type1 = "开启";
        } else {
          type1 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1689)) {
          type2 = "开启";
        } else {
          type2 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1690)) {
          type3 = "开启";
        } else {
          type3 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1691)) {
          type4 = "开启";
        } else {
          type4 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1692)) {
          type5 = "开启";
        } else {
          type5 = "关闭";
        } 
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "pconly3", 
              new String[] { type1, type2, type3, type4, type5 }));
      } else if (cmd.equalsIgnoreCase("pcdrop")) {
        if (this._pc.isActived()) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("挂机中无法使用开关"));
          return;
        } 
        if (this._pc.hasSkillEffect(1690)) {
          this._pc.killSkillEffectTimer(1690);
        } else if (!this._pc.hasSkillEffect(1690)) {
          this._pc.setSkillEffect(1690, 0);
        } 
        String type1 = "";
        String type2 = "";
        String type3 = "";
        String type4 = "";
        String type5 = "";
        if (this._pc.hasSkillEffect(1688)) {
          type1 = "开启";
        } else {
          type1 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1689)) {
          type2 = "开启";
        } else {
          type2 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1690)) {
          type3 = "开启";
        } else {
          type3 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1691)) {
          type4 = "开启";
        } else {
          type4 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1692)) {
          type5 = "开启";
        } else {
          type5 = "关闭";
        } 
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "pconly3", 
              new String[] { type1, type2, type3, type4, type5 }));
      } else if (cmd.equalsIgnoreCase("alldrop")) {
        if (this._pc.isActived()) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("挂机中无法使用开关"));
          return;
        } 
        if (this._pc.hasSkillEffect(1691)) {
          this._pc.killSkillEffectTimer(1691);
        } else if (!this._pc.hasSkillEffect(1691)) {
          this._pc.setSkillEffect(1691, 0);
        } 
        String type1 = "";
        String type2 = "";
        String type3 = "";
        String type4 = "";
        String type5 = "";
        if (this._pc.hasSkillEffect(1688)) {
          type1 = "开启";
        } else {
          type1 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1689)) {
          type2 = "开启";
        } else {
          type2 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1690)) {
          type3 = "开启";
        } else {
          type3 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1691)) {
          type4 = "开启";
        } else {
          type4 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1692)) {
          type5 = "开启";
        } else {
          type5 = "关闭";
        } 
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "pconly3", 
              new String[] { type1, type2, type3, type4, type5 }));
      } else if (cmd.equalsIgnoreCase("yncheck")) {
        if (this._pc.isActived()) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("挂机中无法使用开关"));
          return;
        } 
        if (this._pc.hasSkillEffect(1692)) {
          this._pc.killSkillEffectTimer(1692);
        } else if (!this._pc.hasSkillEffect(1692)) {
          this._pc.setSkillEffect(1692, 0);
        } 
        String type1 = "";
        String type2 = "";
        String type3 = "";
        String type4 = "";
        String type5 = "";
        if (this._pc.hasSkillEffect(1688)) {
          type1 = "开启";
        } else {
          type1 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1689)) {
          type2 = "开启";
        } else {
          type2 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1690)) {
          type3 = "开启";
        } else {
          type3 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1691)) {
          type4 = "开启";
        } else {
          type4 = "关闭";
        } 
        if (this._pc.hasSkillEffect(1692)) {
          type5 = "开启";
        } else {
          type5 = "关闭";
        } 
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "pconly3", 
              new String[] { type1, type2, type3, type4, type5 }));
      } else if (cmd.equalsIgnoreCase("newcharpra")) {
        if (this._pc.hasSkillEffect(55899)) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("此功能无法连续使用"));
          return;
        } 
        if (!L1CastleLocation.checkInAllWarArea(this._pc.getX(), this._pc.getY(), this._pc.getMapId())) {
          if (this._pc.getLevel() <= ConfigOther.newcharpralv) {
            if (this._pc.getnewcharpra()) {
              this._pc.setnewcharpra(false);
              this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("关闭-新手保护"));
              this._pc.setSkillEffect(55899, 60000);
            } else if (!this._pc.getnewcharpra()) {
              this._pc.setnewcharpra(true);
              this._pc.setSkillEffect(55899, 60000);
              this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("开启-新手保护"));
            } 
          } else {
            this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("等级大于" + ConfigOther.newcharpralv + "无法对您进行保护了"));
          } 
        } else {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("旗子内禁止使用此功能"));
        } 
      } else if (cmd.equalsIgnoreCase("qt")) {
        showStartQuest(this._pc, this._pc.getId());
      } else if (cmd.equalsIgnoreCase("quest")) {
        showQuest(this._pc, this._pc.getId());
      } else if (cmd.equalsIgnoreCase("questa")) {
        showQuestAll(this._pc, this._pc.getId());
      } else if (cmd.equalsIgnoreCase("i")) {
        L1Quest quest = QuestTable.get().getTemplate(this._pc.getTempID());
        this._pc.setTempID(0);
        if (quest == null)
          return; 
        QuestClass.get().showQuest(this._pc, quest.get_id());
      } else if (cmd.equalsIgnoreCase("d")) {
        L1Quest quest = QuestTable.get().getTemplate(this._pc.getTempID());
        this._pc.setTempID(0);
        if (quest == null)
          return; 
        if (this._pc.getQuest().isEnd(quest.get_id())) {
          questDel(quest);
          return;
        } 
        if (!this._pc.getQuest().isStart(quest.get_id())) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "y_q_not6"));
          return;
        } 
        questDel(quest);
      } else if (cmd.equalsIgnoreCase("dy")) {
        L1Quest quest = QuestTable.get().getTemplate(this._pc.getTempID());
        this._pc.setTempID(0);
        if (quest == null)
          return; 
        if (this._pc.getQuest().isEnd(quest.get_id())) {
          isDel(quest);
          return;
        } 
        if (!this._pc.getQuest().isStart(quest.get_id())) {
          this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "y_q_not6"));
          return;
        } 
        isDel(quest);
      } else if (cmd.equalsIgnoreCase("up")) {
        int page = this._pc.get_other().get_page() - 1;
        L1ActionShowHtml show = new L1ActionShowHtml(this._pc);
        show.showQuestMap(page);
      } else if (cmd.equalsIgnoreCase("dn")) {
        int page = this._pc.get_other().get_page() + 1;
        L1ActionShowHtml show = new L1ActionShowHtml(this._pc);
        show.showQuestMap(page);
      } else if (cmd.equalsIgnoreCase("q0")) {
        int key = this._pc.get_other().get_page() * 10 + 0;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q1")) {
        int key = this._pc.get_other().get_page() * 10 + 1;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q2")) {
        int key = this._pc.get_other().get_page() * 10 + 2;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q3")) {
        int key = this._pc.get_other().get_page() * 10 + 3;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q4")) {
        int key = this._pc.get_other().get_page() * 10 + 4;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q5")) {
        int key = this._pc.get_other().get_page() * 10 + 5;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q6")) {
        int key = this._pc.get_other().get_page() * 10 + 6;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q7")) {
        int key = this._pc.get_other().get_page() * 10 + 7;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q8")) {
        int key = this._pc.get_other().get_page() * 10 + 8;
        showPage(key);
      } else if (cmd.equalsIgnoreCase("q9")) {
        int key = this._pc.get_other().get_page() * 10 + 9;
        showPage(key);
      } 
      if (cmd.equalsIgnoreCase("Open_AllcallClan")) {
        this._pc.setAllCall_clan(1);
        this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("\\aE穿云箭召换讯息：开启"));
      } else if (cmd.equalsIgnoreCase("Close_AllcallClan")) {
        this._pc.setAllCall_clan(0);
        this._pc.sendPackets((ServerBasePacket)new S_ServerMessage("\\aE穿云箭召换讯息：关闭"));
      } 
      if (cmd.equalsIgnoreCase("Allpcclan")) {
        if (this._pc.isInParty() && 
          !this._pc.getParty().isLeader(this._pc)) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage(416));
          return;
        } 
        if (this._pc.getClanid() == 0) {
          this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("您还没有血盟哦,快去加入一个血盟吧"));
          return;
        } 
        this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("屏幕血盟组队邀请已发送!等待入队..."));
        for (L1Object obj : World.get().getVisibleObjects((L1Object)this._pc)) {
          if (obj instanceof L1PcInstance) {
            L1PcInstance tgpc = (L1PcInstance)obj;
            if (tgpc.isGhost())
              continue; 
            if (tgpc.isDead())
              continue; 
            if (tgpc.isTeleport())
              continue; 
            if (tgpc.getClanid() == 0)
              continue; 
            if (tgpc.getClanid() != this._pc.getClanid())
              continue; 
            if (tgpc.isPrivateShop())
              continue; 
            if (tgpc.isInParty()) {
              if (this._pc.getParty() != null && !this._pc.getParty().isMember(tgpc))
                this._pc.sendPackets((ServerBasePacket)new S_SystemMessage(String.valueOf(tgpc.getName()) + " 已在其他队伍中")); 
              continue;
            } 
            tgpc.setPartyID(this._pc.getId());
            tgpc.sendPackets((ServerBasePacket)new S_Message_YN(953, this._pc.getName()));
          } 
        } 
        return;
      } 
      if (cmd.equalsIgnoreCase("Allpcparty")) {
        if (this._pc.isInParty() && 
          !this._pc.getParty().isLeader(this._pc)) {
          this._pc.sendPackets((ServerBasePacket)new S_ServerMessage(416));
          return;
        } 
        this._pc.sendPackets((ServerBasePacket)new S_SystemMessage("同画面全体组队邀请已发送!等待入队..."));
        for (L1Object obj : World.get().getVisibleObjects((L1Object)this._pc)) {
          if (obj instanceof L1PcInstance) {
            L1PcInstance tgpc = (L1PcInstance)obj;
            if (tgpc.isGhost())
              continue; 
            if (tgpc.isDead())
              continue; 
            if (tgpc.isTeleport())
              continue; 
            if (tgpc.isPrivateShop())
              continue; 
            if (tgpc.isInParty()) {
              if (this._pc.getParty().isMember(tgpc))
                continue; 
              this._pc.sendPackets((ServerBasePacket)new S_SystemMessage(String.valueOf(tgpc.getName()) + " 已在其他队伍中"));
              continue;
            } 
            tgpc.setPartyID(this._pc.getId());
            tgpc.sendPackets((ServerBasePacket)new S_Message_YN(953, this._pc.getName()));
          } 
        } 
        return;
      } 
    } catch (Exception e2) {
      _log.error(e2.getLocalizedMessage(), e2);
    } 
  }
  
  private void usePolyScroll(L1PcInstance pc, L1ItemInstance item, String s) {
    try {
      L1PolyMorph poly = PolyTable.get().getTemplate(s);
      int time = 1800;
      if (item.getBless() == 0)
        time = 2100; 
      if (item.getBless() == 128)
        time = 2100; 
      boolean isUseItem = false;
      if (s.equals("none")) {
        if (pc.getTempCharGfx() == 6034 || pc.getTempCharGfx() == 6035) {
          isUseItem = true;
        } else {
          L1PolyMorph.undoPoly((L1Character)pc);
          isUseItem = true;
        } 
      } else if (poly.getMinLevel() <= pc.getLevel() || pc.isGm()) {
        if (poly.getPolyId() == 13715 && (pc.get_sex() != 0 || !pc.isCrown())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13717 && (pc.get_sex() != 1 || !pc.isCrown())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13719 && (pc.get_sex() != 0 || !pc.isKnight())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13721 && (pc.get_sex() != 1 || !pc.isKnight())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13723 && (pc.get_sex() != 0 || !pc.isElf())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13725 && (pc.get_sex() != 1 || !pc.isElf())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13727 && (pc.get_sex() != 0 || !pc.isWizard())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13729 && (pc.get_sex() != 1 || !pc.isWizard())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13731 && (pc.get_sex() != 0 || !pc.isDarkelf())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13733 && (pc.get_sex() != 1 || !pc.isDarkelf())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13735 && (pc.get_sex() != 0 || !pc.isDragonKnight())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13737 && (pc.get_sex() != 1 || !pc.isDragonKnight())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13739 && (pc.get_sex() != 0 || !pc.isIllusionist())) {
          isUseItem = false;
        } else if (poly.getPolyId() == 13741 && (pc.get_sex() != 1 || !pc.isIllusionist())) {
          isUseItem = false;
        } else {
          L1PolyMorph.doPoly((L1Character)pc, poly.getPolyId(), time, 1);
          isUseItem = true;
        } 
      } 
      if (isUseItem) {
        pc.getInventory().removeItem(item, 1L);
        pc.sendPackets((ServerBasePacket)new S_CloseList(pc.getId()));
      } else {
        pc.sendPackets((ServerBasePacket)new S_ServerMessage(181));
        pc.sendPackets((ServerBasePacket)new S_CloseList(pc.getId()));
      } 
      pc.setItemPoly(false);
      pc.setPolyScroll(null);
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  private void usePolyBook(L1PcInstance pc, L1ItemInstance item, String s) {
    try {
      L1PolyMorph poly = PolyTable.get().getTemplate(s);
      int time = 1800;
      if (item.getBless() == 0)
        time = 2100; 
      if (item.getBless() == 128)
        time = 2100; 
      boolean isUseItem = false;
      if (s.equals("none")) {
        if (pc.getTempCharGfx() == 6034 || pc.getTempCharGfx() == 6035) {
          isUseItem = true;
        } else {
          L1PolyMorph.undoPoly((L1Character)pc);
          isUseItem = true;
        } 
      } else {
        L1PolyMorph.doPoly((L1Character)pc, poly.getPolyId(), time, 1);
        isUseItem = true;
      } 
      if (isUseItem) {
        pc.sendPackets((ServerBasePacket)new S_CloseList(pc.getId()));
      } else {
        pc.sendPackets((ServerBasePacket)new S_ServerMessage(181));
        pc.sendPackets((ServerBasePacket)new S_CloseList(pc.getId()));
      } 
      pc.setItemPoly(false);
      pc.setPolyScroll(null);
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  private void usePolyBookcouitem(L1PcInstance pc, L1ItemInstance item, String s) {
    try {
      L1PolyMorph poly = PolyTable.get().getTemplate(s);
      int time = 1800;
      if (item.getBless() == 0)
        time = 2100; 
      if (item.getBless() == 128)
        time = 2100; 
      boolean isUseItem = false;
      if (s.equals("none")) {
        if (pc.getTempCharGfx() == 6034 || pc.getTempCharGfx() == 6035) {
          isUseItem = true;
        } else {
          L1PolyMorph.undoPoly((L1Character)pc);
          isUseItem = true;
        } 
      } else {
        L1PolyMorph.doPoly((L1Character)pc, poly.getPolyId(), time, 1);
        isUseItem = true;
      } 
      if (isUseItem) {
        pc.sendPackets((ServerBasePacket)new S_CloseList(pc.getId()));
      } else {
        pc.sendPackets((ServerBasePacket)new S_ServerMessage(181));
        pc.sendPackets((ServerBasePacket)new S_CloseList(pc.getId()));
      } 
      pc.setItemPoly(false);
      pc.setPolyScroll(null);
      pc.getInventory().removeItem(item, 1L);
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  private void usePhantomTeleport(L1PcInstance pc, String cmd) {
    try {
      int x = 0;
      int y = 0;
      short mapid = 0;
      String str;
      switch ((str = cmd).hashCode()) {
        case 97:
          if (!str.equals("a"))
            break; 
          x = 32797;
          y = 32799;
          mapid = 3301;
          break;
        case 98:
          if (!str.equals("b"))
            break; 
          x = 32797;
          y = 32799;
          mapid = 3302;
          break;
        case 99:
          if (!str.equals("c"))
            break; 
          x = 32797;
          y = 32799;
          mapid = 3303;
          break;
        case 100:
          if (!str.equals("d"))
            break; 
          x = 32668;
          y = 32864;
          mapid = 3304;
          break;
        case 101:
          if (!str.equals("e"))
            break; 
          x = 32668;
          y = 32864;
          mapid = 3305;
          break;
        case 102:
          if (!str.equals("f"))
            break; 
          x = 32717;
          y = 32871;
          mapid = 3306;
          break;
        case 103:
          if (!str.equals("g"))
            break; 
          x = 32668;
          y = 32864;
          mapid = 3307;
          break;
        case 104:
          if (!str.equals("h"))
            break; 
          x = 32668;
          y = 32864;
          mapid = 3308;
          break;
        case 105:
          if (!str.equals("i"))
            break; 
          x = 32668;
          y = 32864;
          mapid = 3309;
          break;
        case 106:
          if (!str.equals("j"))
            break; 
          x = 32797;
          y = 32799;
          mapid = 3310;
          break;
        case 107:
          if (!str.equals("k"))
            break; 
          x = 32760;
          y = 32894;
          mapid = 7100;
          break;
        case 108:
          if (!str.equals("l"))
            break; 
          x = 32692;
          y = 32903;
          mapid = 7100;
          break;
      } 
      L1Teleport.teleport(pc, x, y, mapid, pc.getHeading(), true);
      pc.setPhantomTeleport(false);
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  private void questDel(L1Quest quest) {
    try {
      if (quest.is_del()) {
        this._pc.setTempID(quest.get_id());
        String over = null;
        if (this._pc.getQuest().isEnd(quest.get_id())) {
          over = "完成任务";
        } else {
          over = String.valueOf(String.valueOf(this._pc.getQuest().get_step(quest.get_id()))) + " / " + 
            quest.get_difficulty();
        } 
        String[] info = { quest.get_questname(), Integer.toString(quest.get_questlevel()), over };
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "y_qi2", info));
      } else {
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "y_q_not5"));
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  private void isDel(L1Quest quest) {
    try {
      if (quest.is_del()) {
        QuestClass.get().stopQuest(this._pc, quest.get_id());
        CharacterQuestReading.get().delQuest(this._pc.getId(), quest.get_id());
        String[] info = { quest.get_questname(), Integer.toString(quest.get_questlevel()) };
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "y_qi3", info));
      } else {
        this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "y_q_not5"));
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  private boolean checkvalid(L1PcInstance pc, String cmd) {
    int initpoint = C_CreateChar.ORIGINAL_AMOUNT[pc.getType()];
    if (pc.isInCharReset()) {
      if (cmd.equalsIgnoreCase("initStr")) {
        if (pc.getBaseStr() >= C_CreateChar.MAX_STR[pc.getType()]) {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("该能力初始已达上限"));
          return false;
        } 
        if (pc.getBaseStr() < 20) {
          if (initpoint - pc.getTempInitPoint() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("初始点数上限只能到20。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("initInt")) {
        if (pc.getBaseInt() >= C_CreateChar.MAX_INT[pc.getType()]) {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("该能力初始已达上限"));
          return false;
        } 
        if (pc.getBaseInt() < 20) {
          if (initpoint - pc.getTempInitPoint() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("初始点数上限只能到20。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("initWis")) {
        if (pc.getBaseWis() >= C_CreateChar.MAX_WIS[pc.getType()]) {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("该能力初始已达上限"));
          return false;
        } 
        if (pc.getBaseWis() < 20) {
          if (initpoint - pc.getTempInitPoint() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("初始点数上限只能到20。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("initDex")) {
        if (pc.getBaseDex() >= C_CreateChar.MAX_DEX[pc.getType()]) {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("该能力初始已达上限"));
          return false;
        } 
        if (pc.getBaseDex() < 20) {
          if (initpoint - pc.getTempInitPoint() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("初始点数上限只能到20。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("initCon")) {
        if (pc.getBaseCon() >= C_CreateChar.MAX_CON[pc.getType()]) {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("该能力初始已达上限"));
          return false;
        } 
        if (pc.getBaseCon() < 20) {
          if (initpoint - pc.getTempInitPoint() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("初始点数上限只能到20。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("initCha")) {
        if (pc.getBaseCha() >= C_CreateChar.MAX_CHA[pc.getType()]) {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("该能力初始已达上限"));
          return false;
        } 
        if (pc.getBaseCha() < 20) {
          if (initpoint - pc.getTempInitPoint() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("初始点数上限只能到20。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("Str")) {
        if (pc.getBaseStr() < ConfigAlt.BaseResetPOWER) {
          if (pc.getTempMaxLevel() - pc.getTempLevel() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.BaseResetPOWER + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("Int")) {
        if (pc.getBaseInt() < ConfigAlt.BaseResetPOWER) {
          if (pc.getTempMaxLevel() - pc.getTempLevel() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.BaseResetPOWER + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("Wis")) {
        if (pc.getBaseWis() < ConfigAlt.BaseResetPOWER) {
          if (pc.getTempMaxLevel() - pc.getTempLevel() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.BaseResetPOWER + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("Dex")) {
        if (pc.getBaseDex() < ConfigAlt.BaseResetPOWER) {
          if (pc.getTempMaxLevel() - pc.getTempLevel() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.BaseResetPOWER + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("Con")) {
        if (pc.getBaseCon() < ConfigAlt.BaseResetPOWER) {
          if (pc.getTempMaxLevel() - pc.getTempLevel() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.BaseResetPOWER + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("Cha")) {
        if (pc.getBaseCha() < ConfigAlt.BaseResetPOWER) {
          if (pc.getTempMaxLevel() - pc.getTempLevel() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.BaseResetPOWER + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("exStr")) {
        if (pc.getBaseStr() < ConfigAlt.POWERMEDICINE) {
          if (pc.getElixirStats() - pc.getTempElixirstats() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.POWERMEDICINE + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("exInt")) {
        if (pc.getBaseInt() < ConfigAlt.POWERMEDICINE) {
          if (pc.getElixirStats() - pc.getTempElixirstats() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.POWERMEDICINE + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("exWis")) {
        if (pc.getBaseWis() < ConfigAlt.POWERMEDICINE) {
          if (pc.getElixirStats() - pc.getTempElixirstats() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.POWERMEDICINE + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("exDex")) {
        if (pc.getBaseDex() < ConfigAlt.POWERMEDICINE) {
          if (pc.getElixirStats() - pc.getTempElixirstats() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.POWERMEDICINE + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("exCon")) {
        if (pc.getBaseCon() < ConfigAlt.POWERMEDICINE) {
          if (pc.getElixirStats() - pc.getTempElixirstats() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.POWERMEDICINE + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("exCha")) {
        if (pc.getBaseCha() < ConfigAlt.POWERMEDICINE) {
          if (pc.getElixirStats() - pc.getTempElixirstats() > 0)
            return true; 
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("已经没有多余的点数了。"));
        } else {
          pc.sendPackets((ServerBasePacket)new S_ServerMessage("属性最大值只能到" + ConfigAlt.POWERMEDICINE + "。 请重试一次。"));
        } 
      } else if (cmd.equalsIgnoreCase("1")) {
        if (pc.getTempMaxLevel() - pc.getTempLevel() >= 1)
          return true; 
        pc.sendPackets((ServerBasePacket)new S_ServerMessage("无法再继续升级了。"));
      } else if (cmd.equalsIgnoreCase("10")) {
        if (pc.getTempMaxLevel() - pc.getTempLevel() >= 10)
          return true; 
        pc.sendPackets((ServerBasePacket)new S_ServerMessage("无法再继续升级了。"));
      } 
    } else {
      pc.sendPackets((ServerBasePacket)new S_ServerMessage("必须在人物重置模式下才能使用！"));
    } 
    return false;
  }
  
  private void setLevelUp(L1PcInstance pc, int addLv) {
    pc.setTempLevel(pc.getTempLevel() + addLv);
    int i = 0;
    while (i < addLv) {
      short randomHp = CalcStat.calcStatHp(pc.getType(), pc.getBaseMaxHp(), pc.getBaseCon(), 
          pc.getOriginalHpup());
      short randomMp = CalcStat.calcStatMp(pc.getType(), pc.getBaseMaxMp(), pc.getBaseWis(), 
          pc.getOriginalMpup());
      pc.addBaseMaxHp(randomHp);
      pc.addBaseMaxMp(randomMp);
      i++;
    } 
    pc.setExp(ExpTable.getExpByLevel(pc.getTempLevel()));
    pc.resetLevel();
    pc.sendPackets((ServerBasePacket)new S_SPMR(pc));
    pc.sendPackets((ServerBasePacket)new S_OwnCharStatus(pc));
    pc.sendPackets((ServerBasePacket)new S_PacketBox(132, pc.getEr()));
  }
  
  private void showPage(int key) {
    try {
      L1Quest quest = (L1Quest)(this._pc.get_otherList()).QUESTMAP.get(Integer.valueOf(key));
      this._pc.setTempID(quest.get_id());
      String over = null;
      if (this._pc.getQuest().isEnd(quest.get_id())) {
        over = "完成任务";
      } else {
        over = String.valueOf(String.valueOf(this._pc.getQuest().get_step(quest.get_id()))) + " / " + quest.get_difficulty();
      } 
      String[] info = { quest.get_questname(), Integer.toString(quest.get_questlevel()), over, "" };
      this._pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(this._pc.getId(), "y_qi1", info));
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  public void BadEnemyList(L1PcInstance pc) {
    StringBuilder msg = new StringBuilder();
    Iterator<String> iterator = pc.InBadEnemyList().iterator();
    while (iterator.hasNext()) {
      String name = iterator.next();
      msg.append(String.valueOf(String.valueOf(name)) + ",");
    } 
    String[] clientStrAry = msg.toString().split(",");
    pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "x_autolist4", clientStrAry));
  }
  
  private class AllBuffRunnable implements Runnable {
    private AllBuffRunnable() {}
    
    public void run() {
      try {
        Iterator<L1PcInstance> iterator = World.get().getAllPlayers().iterator();
        while (iterator.hasNext()) {
          L1PcInstance tgpc = iterator.next();
          startPc(tgpc);
          Thread.sleep(1L);
        } 
      } catch (Exception exception) {}
    }
    
    public void startPc(L1PcInstance target) {
      int[] allBuffSkill = ConfigOther.Give_skill1;
      int i = 0;
      while (i < allBuffSkill.length) {
        L1Skills skill = SkillsTable.get().getTemplate(allBuffSkill[i]);
        L1SkillUse skillUse = new L1SkillUse();
        skillUse.handleCommands(target, allBuffSkill[i], target.getId(), target.getX(), target.getY(), 
            skill.getBuffDuration(), 4);
        i++;
      } 
    }
  }
}
